package com.rc.mutievcharger.dto.ylevcharger.terminal.req;

import com.rc.evcharger.common.annotation.ByteLength;
import com.rc.evcharger.common.base.yl.BaseYlCommand;
import com.rc.evcharger.common.constant.SocketConstant;
import com.rc.evcharger.common.utils.DataUtil;
import com.rc.evcharger.common.utils.StringUtil;

import java.lang.reflect.Field;
import java.math.BigDecimal;

/**
 * Create by Yang on 2021/4/26
 * (CMD=104)充电桩状态信息包上报
 */
public class YlChargingCommandReq extends BaseYlCommand {

    @ByteLength(length = 2)
    private String obligate1; //预留字段1
    @ByteLength(length = 2)
    private String obligate2; //预留字段1
    @ByteLength(length = 32)
    private String terminalId; //充电桩编号
    @ByteLength(length = 1)
    private String gunCount;  //充电枪数量
    @ByteLength(length = 1)
    private String gunNum;  //充电口号  //编码从 1 开始,如有 2 枪，那这个字段的值为 1、2 两个值
    @ByteLength(length = 1)
    private String gunType;  //BIT0~BIT1:1=直流；2=交流；
    @ByteLength(length = 1)
    private String runStatus;  //工作状态   0-空闲中1-正准备开始充电2-充电进行中3-充电结束4-启动失败5-预约状态6-系统故障(不能给汽车充电
    @ByteLength(length = 1)
    private BigDecimal soc;  //当前soc （直流有效，交流无效）
    @ByteLength(length = 4)
    private BigDecimal warnCode;  //当前最高告警编码  0- 无告警
    @ByteLength(length = 1)
    private String connectStatus;  //车连接状态 0- 断开 1-半连接 2-连接 只有状态不为 0 时，手机才能下发开机指令
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal totalMoney; // 本次充电累计充电费用 要乘以 0.01 才能得到真实的金额
    @ByteLength(length = 4)
    private String obligate8; // 预留2
    @ByteLength(length = 4)
    private String obligate9; // 预留3
    @ByteLength(length = 2, decimal = 1)
    private BigDecimal voltage;// 直流充电电压 精确到小数点后一位；待机置零
    @ByteLength(length = 2, decimal = 1)
    private BigDecimal elec; // 直流充电电流 精确到小数点后一位；待机置零
    @ByteLength(length = 2, decimal = 1)
    private BigDecimal demandVoltage; //BMS需求电压 待机置零
    @ByteLength(length = 2, decimal = 1)
    private BigDecimal demandElec; //BMS需求电流  待机置零
    @ByteLength(length = 1)
    private String chargeMode; //1- 恒压  2- 恒流
    @ByteLength(length = 2, decimal = 1)
    private BigDecimal voltageA;// A相电压 精确到小数点后一位；待机置零
    @ByteLength(length = 2, decimal = 1)
    private BigDecimal voltageB;// B相电压 精确到小数点后一位；待机置零
    @ByteLength(length = 2, decimal = 1)
    private BigDecimal voltageC;// C相电压 精确到小数点后一位；待机置零
    @ByteLength(length = 2, decimal = 1)
    private BigDecimal elecA; // A相电流 精确到小数点后一位；待机置零
    @ByteLength(length = 2, decimal = 1)
    private BigDecimal elecB; // B相电流 精确到小数点后一位；待机置零
    @ByteLength(length = 2, decimal = 1)
    private BigDecimal elecC; // C相电流 精确到小数点后一位；待机置零
    @ByteLength(length = 2)
    private BigDecimal remainChargingTime;  //剩余充电时间(min)    充电有效（直流有效，交流无效）
    @ByteLength(length = 4)
    private BigDecimal chargingTime;  //充电时长(秒)   状态为充电时才有效
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal power;  //本次充电累计充电电量 （0.01kwh）
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal beginMeterPower;  //充电前电表读数   0.01kw
    @ByteLength(length = 4, decimal = 2)
    private BigDecimal currMeterPower;  //当前电表读数  0.01kw
    @ByteLength(length = 1)
    private String startType;  //充电启动方式   0：本地刷卡启动  1：后台启动  2：本地管理员启动  3：本地 VIN 验证启动
    @ByteLength(length = 1)
    private BigDecimal chargingPolicy;  //充电策略   0 自动充满 1 按时间充满 2 定金额 3 按电量充满
    @ByteLength(length = 4)
    private BigDecimal chargingPolicyParm;  //充电策略参数   时间单位为 1 秒 金额单位为 0.01 元 电量时单位为 0.01kw
    @ByteLength(length = 1)
    private String appointmentSign;  //预约标志   0-无预约（无效） 1-预约有效
    @ByteLength(length = 32)
    private String card;  //充电/预约卡号   ASCII 码，不够长度填’\0’
    @ByteLength(length = 1)
    private BigDecimal appointmentTime;  //预约超时时间  单位分钟
    @ByteLength(length = 8)
    private String appointmentBeginTime;  //标准时间   预约/开始充电开始时间
    @ByteLength(length = 4)
    private BigDecimal accountCard;  //充电前卡余额   ASCII 码，不够长度填’\0’
    @ByteLength(length = 4)
    private String obligate6;  //预留
    @ByteLength(length = 4,decimal = 1)
    private BigDecimal chargePower;  //充电功率 O.lkW/BIT
    @ByteLength(length = 4)
    private String inVariable3;  //系统变量 3
    @ByteLength(length = 4)
    private String inVariable4;  //系统变量 4
    @ByteLength(length = 4)
    private String inVariable5;  //系统变量 5
    @ByteLength(length = 1)
    private BigDecimal temperatureF;  //出风口温度
    @ByteLength(length = 1)
    private BigDecimal temperatureH;  //环境温度
    @ByteLength(length = 1)
    private BigDecimal temperatureGun;  //充电枪温度
    @ByteLength(length = 32)
    private String orderNum;  //充电流水号


    public String getObligate1() {
        return obligate1;
    }

    public void setObligate1(String obligate1) {
        this.obligate1 = obligate1;
    }

    public String getObligate2() {
        return obligate2;
    }

    public void setObligate2(String obligate2) {
        this.obligate2 = obligate2;
    }

    @Override
    public String getTerminalId() {
        return terminalId;
    }

    @Override
    public void setTerminalId(String terminalId) {
        this.terminalId = terminalId;
    }

    public String getGunCount() {
        return gunCount;
    }

    public void setGunCount(String gunCount) {
        this.gunCount = gunCount;
    }

    public String getGunNum() {
        return gunNum;
    }

    public void setGunNum(String gunNum) {
        this.gunNum = gunNum;
    }

    public String getGunType() {
        return gunType;
    }

    public void setGunType(String gunType) {
        this.gunType = gunType;
    }

    public String getRunStatus() {
        return runStatus;
    }

    public void setRunStatus(String runStatus) {
        this.runStatus = runStatus;
    }

    public BigDecimal getSoc() {
        return soc;
    }

    public void setSoc(BigDecimal soc) {
        this.soc = soc;
    }

    public BigDecimal getWarnCode() {
        return warnCode;
    }

    public void setWarnCode(BigDecimal warnCode) {
        this.warnCode = warnCode;
    }

    public String getConnectStatus() {
        return connectStatus;
    }

    public void setConnectStatus(String connectStatus) {
        this.connectStatus = connectStatus;
    }

    public BigDecimal getTotalMoney() {
        return totalMoney;
    }

    public void setTotalMoney(BigDecimal totalMoney) {
        this.totalMoney = totalMoney;
    }

    public String getObligate8() {
        return obligate8;
    }

    public void setObligate8(String obligate8) {
        this.obligate8 = obligate8;
    }

    public String getObligate9() {
        return obligate9;
    }

    public void setObligate9(String obligate9) {
        this.obligate9 = obligate9;
    }

    public BigDecimal getVoltage() {
        return voltage;
    }

    public void setVoltage(BigDecimal voltage) {
        this.voltage = voltage;
    }

    public BigDecimal getElec() {
        return elec;
    }

    public void setElec(BigDecimal elec) {
        this.elec = elec;
    }

    public BigDecimal getDemandVoltage() {
        return demandVoltage;
    }

    public void setDemandVoltage(BigDecimal demandVoltage) {
        this.demandVoltage = demandVoltage;
    }

    public BigDecimal getDemandElec() {
        return demandElec;
    }

    public void setDemandElec(BigDecimal demandElec) {
        this.demandElec = demandElec;
    }

    public String getChargeMode() {
        return chargeMode;
    }

    public void setChargeMode(String chargeMode) {
        this.chargeMode = chargeMode;
    }

    public BigDecimal getVoltageA() {
        return voltageA;
    }

    public void setVoltageA(BigDecimal voltageA) {
        this.voltageA = voltageA;
    }

    public BigDecimal getVoltageB() {
        return voltageB;
    }

    public void setVoltageB(BigDecimal voltageB) {
        this.voltageB = voltageB;
    }

    public BigDecimal getVoltageC() {
        return voltageC;
    }

    public void setVoltageC(BigDecimal voltageC) {
        this.voltageC = voltageC;
    }

    public BigDecimal getElecA() {
        return elecA;
    }

    public void setElecA(BigDecimal elecA) {
        this.elecA = elecA;
    }

    public BigDecimal getElecB() {
        return elecB;
    }

    public void setElecB(BigDecimal elecB) {
        this.elecB = elecB;
    }

    public BigDecimal getElecC() {
        return elecC;
    }

    public void setElecC(BigDecimal elecC) {
        this.elecC = elecC;
    }

    public BigDecimal getRemainChargingTime() {
        return remainChargingTime;
    }

    public void setRemainChargingTime(BigDecimal remainChargingTime) {
        this.remainChargingTime = remainChargingTime;
    }

    public BigDecimal getChargingTime() {
        return chargingTime;
    }

    public void setChargingTime(BigDecimal chargingTime) {
        this.chargingTime = chargingTime;
    }

    public BigDecimal getPower() {
        return power;
    }

    public void setPower(BigDecimal power) {
        this.power = power;
    }

    public BigDecimal getBeginMeterPower() {
        return beginMeterPower;
    }

    public void setBeginMeterPower(BigDecimal beginMeterPower) {
        this.beginMeterPower = beginMeterPower;
    }

    public BigDecimal getCurrMeterPower() {
        return currMeterPower;
    }

    public void setCurrMeterPower(BigDecimal currMeterPower) {
        this.currMeterPower = currMeterPower;
    }

    public String getStartType() {
        return startType;
    }

    public void setStartType(String startType) {
        this.startType = startType;
    }

    public BigDecimal getChargingPolicy() {
        return chargingPolicy;
    }

    public void setChargingPolicy(BigDecimal chargingPolicy) {
        this.chargingPolicy = chargingPolicy;
    }

    public BigDecimal getChargingPolicyParm() {
        return chargingPolicyParm;
    }

    public void setChargingPolicyParm(BigDecimal chargingPolicyParm) {
        this.chargingPolicyParm = chargingPolicyParm;
    }

    public String getAppointmentSign() {
        return appointmentSign;
    }

    public void setAppointmentSign(String appointmentSign) {
        this.appointmentSign = appointmentSign;
    }

    public String getCard() {
        return card;
    }

    public void setCard(String card) {
        this.card = card;
    }

    public BigDecimal getAppointmentTime() {
        return appointmentTime;
    }

    public void setAppointmentTime(BigDecimal appointmentTime) {
        this.appointmentTime = appointmentTime;
    }

    public String getAppointmentBeginTime() {
        return appointmentBeginTime;
    }

    public void setAppointmentBeginTime(String appointmentBeginTime) {
        this.appointmentBeginTime = appointmentBeginTime;
    }

    public BigDecimal getAccountCard() {
        return accountCard;
    }

    public void setAccountCard(BigDecimal accountCard) {
        this.accountCard = accountCard;
    }

    public String getObligate6() {
        return obligate6;
    }

    public void setObligate6(String obligate6) {
        this.obligate6 = obligate6;
    }

    public BigDecimal getChargePower() {
        return chargePower;
    }

    public void setChargePower(BigDecimal chargePower) {
        this.chargePower = chargePower;
    }

    public String getInVariable3() {
        return inVariable3;
    }

    public void setInVariable3(String inVariable3) {
        this.inVariable3 = inVariable3;
    }

    public String getInVariable4() {
        return inVariable4;
    }

    public void setInVariable4(String inVariable4) {
        this.inVariable4 = inVariable4;
    }

    public String getInVariable5() {
        return inVariable5;
    }

    public void setInVariable5(String inVariable5) {
        this.inVariable5 = inVariable5;
    }

    public BigDecimal getTemperatureF() {
        return temperatureF;
    }

    public void setTemperatureF(BigDecimal temperatureF) {
        this.temperatureF = temperatureF;
    }

    public BigDecimal getTemperatureH() {
        return temperatureH;
    }

    public void setTemperatureH(BigDecimal temperatureH) {
        this.temperatureH = temperatureH;
    }

    public BigDecimal getTemperatureGun() {
        return temperatureGun;
    }

    public void setTemperatureGun(BigDecimal temperatureGun) {
        this.temperatureGun = temperatureGun;
    }

    public String getOrderNum() {
        return orderNum;
    }

    public void setOrderNum(String orderNum) {
        this.orderNum = orderNum;
    }

    public static void main(String[] args) {
        System.out.println(Integer.toHexString(263));
        System.out.println(Integer.parseInt("0107", 16));
    }
}
